/**
 * 自定义Message组件样式
 * 仿照Element UI的Message组件
 */

/* 变量定义 */
:root {
  --message-font-size: 14px;
  --message-padding: 15px 20px;
  --message-border-radius: 4px;
  --message-box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  --message-background: #fff;
  --message-min-width: 200px;
  --message-max-width: 300px;
  
  /* 颜色变量 */
  --message-success-color: #67C23A;
  --message-warning-color: #E6A23C;
  --message-error-color: #F56C6C;
  --message-info-color: #909399;
}

/* 消息容器 */
.custom-message-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 9999;
  pointer-events: none; /* 允许点击穿透 */
}

/* 消息项 */
.custom-message {
  display: flex;
  align-items: center;
  padding: 10px 15px;
  margin-bottom: 10px;
  border-radius: var(--message-border-radius);
  box-shadow: var(--message-box-shadow);
  background: var(--message-background);
  min-width: var(--message-min-width);
  max-width: var(--message-max-width);
  box-sizing: border-box;
  pointer-events: auto; /* 允许消息本身可点击 */
  transition: opacity 0.3s, transform 0.3s;
  opacity: 0;
  transform: translateY(-20px);
}

.custom-message.show {
  opacity: 1;
  transform: translateY(0);
}

/* 图标样式 */
.custom-message .icon {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  font-style: normal;
}

/* 内容样式 */
.custom-message .content {
  flex: 1;
  font-size: 13px;
  line-height: 1.4;
}

/* 关闭按钮 */
.custom-message .close {
  margin-left: 10px;
  cursor: pointer;
  color: #C0C4CC;
  font-size: 16px;
  font-weight: bold;
  opacity: 0.7;
}

.custom-message .close:hover {
  opacity: 1;
}

/* 消息类型样式 */
.custom-message.success {
  background-color: #f0f9eb;
  border: 1px solid #e1f3d8;
}

.custom-message.success .icon {
  color: var(--message-success-color);
}

.custom-message.warning {
  background-color: #fdf6ec;
  border: 1px solid #faecd8;
}

.custom-message.warning .icon {
  color: var(--message-warning-color);
}

.custom-message.error {
  background-color: #fef0f0;
  border: 1px solid #fde2e2;
}

.custom-message.error .icon {
  color: var(--message-error-color);
}

.custom-message.info {
  background-color: #f4f4f5;
  border: 1px solid #e9e9eb;
}

.custom-message.info .icon {
  color: var(--message-info-color);
}

/* 动画效果 */
@keyframes message-fade-in {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes message-fade-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}